package com.cn.bdqn.FileIO;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.*;
import java.io.IOException;

public class Code11 {
	public static void main(String[] args) {
		

		DataInputStream dis=null;
		DataOutputStream dos=null;
		try {
			dis=new DataInputStream(new FileInputStream("d://hello.txt"));
			dos=new DataOutputStream(new FileOutputStream("d://Copy.txt"));
			
			int temp;
			while((temp=dis.read())!=-1){
				dos.write(temp);			
			}			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block

			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block

			e.printStackTrace();
		}finally{
			if(dis!=null){
				try {
					dis.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block

					e.printStackTrace();
				}
			}
			if(dos!=null){
				try {
					dos.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block

					e.printStackTrace();
				}
			}
		}
	}
}